﻿<Page x:Class="PFC.Program.Profile.Pages.Main"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:PFC.Program.Profile.Pages"
      xmlns:ScottPlot="clr-namespace:ScottPlot;assembly=ScottPlot.WPF"
      mc:Ignorable="d" 
      xmlns:n="clr-namespace:PFC.CustomControls"
      d:DesignHeight="350" 
      d:DesignWidth="800"
      Title="Main">

    <Page.Resources>

        <!--Кастомный ListBox-->
        <DataTemplate x:Key="CustomListBox">
            <Grid Background="Transparent">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="165"/>
                    <ColumnDefinition Width="125"/>
                    <ColumnDefinition Width="280"/>
                    <ColumnDefinition Width="155"/>
                </Grid.ColumnDefinitions>

                <Label Content="{Binding Category}"
                       Grid.Column="0"
                       FontFamily="Calibri"
                       FontSize="15"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"
                       Width="145"
                       Margin="15 10 5 0">

                    <Label.Resources>
                        <Style TargetType="Border">
                            <Setter Property="CornerRadius" 
                                    Value="5 0 0 5"/>
                        </Style>
                    </Label.Resources>

                </Label>

                <Label Content="{Binding Sum}"
                       FontFamily="Calibri"
                       FontSize="15"
                       Grid.Column="1"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Width="120"
                       Margin="0 10 5 0"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"/>

                <Label Content="{Binding Description}"
                       Grid.Column="2"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Width="275"
                       FontSize="15"
                       FontFamily="Calibri"
                       Margin="0 10 5 0"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"/>

                <Label Content="{Binding Date}"
                       Grid.Column="3"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Width="140"
                       FontSize="15"
                       FontFamily="Calibri"
                       Margin="0 10 5 0"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1">

                    <Label.Resources>
                        <Style TargetType="Border">
                            <Setter Property="CornerRadius" 
                                    Value="0 5 5 0"/>
                        </Style>
                    </Label.Resources>

                </Label>

            </Grid>
        </DataTemplate>
    </Page.Resources>


    <Grid Background="#FFFF8000">

        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="210"/>
            <RowDefinition Height="100"/>
        </Grid.RowDefinitions>

        <!--Название кошелька-->
        <TextBlock Name="nameWallet_Txb"
                   FontSize="20"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Bottom"
                   Margin="20 0 0 0"
                   FontFamily="Calibri"
                   Foreground="White"
                   Text="Название кошелька"/>

        <!--Возврат на страницу списка кошельков-->
        <Button Name="back_Btn"
                Style="{DynamicResource ButtonStyle}"
                Width="60"
                Height="35"
                Content="Назад"
                VerticalAlignment="Center"
                Click="back_Btn_Click"/>

        <!--Удаление кошелька-->
        <n:NavButton x:Name="deleteWallet_NavBtn"
                     ImageSource="/Resources/deleteWallet.png"
                     HorizontalAlignment="Right"
                     Margin="0 0 25 0"
                     Click="deleteWallet_NavBtn_Click"/>

        <!--Список транзакций-->
        <ListBox Name="listTransactions_Lbx"
                 Grid.Row="1"
                 Margin="0 5 0 0"
                 ItemTemplate="{DynamicResource CustomListBox}"
                 d:ItemsSource="{d:SampleData ItemCount=3}"
                 VerticalAlignment="Top"
                 Height="200"
                 Width="750">

            <ListBox.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius"
                               Value="5"/>
                </Style>

                <!--Убираем наведение на Items в ListBox-->
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Background" Value="Transparent" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <ContentPresenter />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

            </ListBox.Resources>

        </ListBox>

        
        <!--Бар с расходами и доходами-->
        <Border Name="BarPlotBorder"
                Grid.Row="2"
                BorderBrush="White"
                BorderThickness="2"
                Visibility="Visible"
                Width="230"
                Height="85"
                HorizontalAlignment="Left"
                Margin="18 0 0 10">

            <Border.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius"
                               Value="5"/>
                </Style>
            </Border.Resources>
            
            <ScottPlot:WpfPlot x:Name="BarPlot"/>
        </Border>
        
        <!--Круговая диагромма частот-->
        <Border Name="FreqPiePlotBorder"
                Visibility="Hidden"
                Grid.Row="2"
                BorderBrush="White"
                BorderThickness="2"
                Width="100"
                Margin="0 0 80 10"
                Height="85"
                HorizontalAlignment="Right">

            <Border.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius"
                               Value="5"/>
                </Style>
            </Border.Resources>

            <ScottPlot:WpfPlot x:Name="FreqPiePlot"/>

        </Border>
        
        <!--Горизонтальный стек с кнопками-->
        <StackPanel Grid.Row="2"
                    Orientation="Horizontal"
                    HorizontalAlignment="Center"
                    Height="50"
                    VerticalAlignment="Top">


            <!--Кнопка перехода на страницу пополнения-->
            <WrapPanel Grid.Row="2"
                       Name="ProfitPage_Wrap"
                       ButtonBase.Click="ProfitPage_Wrap_Click"
                       VerticalAlignment="Top"
                       Margin="175 3 0 0">

                <n:NavButton ImageSource="/Resources/add.png"
                             Width="45"
                             NavUri="/Program/Profile/Pages/ProfitPage.xaml"/>

            </WrapPanel>

            <!--Баланс-->
            <Label Name="balance_Lb"
                   FontSize="25"
                   Content="000"
                   FontFamily="Calibri"
                   Margin="0 5 0 0"
                   VerticalAlignment="Top"
                   Background="White">

                <Label.Resources>
                    <Style TargetType="Border">
                        <Setter Property="CornerRadius"
                               Value="5"/>
                    </Style>
                </Label.Resources>

            </Label>

            <!--Кнопка перехода на страницу траты-->
            <WrapPanel Name="ExpensePage_Wrap"
                       ButtonBase.Click="ExpensePage_Wrap_Click"
                       VerticalAlignment="Top"
                       Margin="0 3 175 0">

                <n:NavButton ImageSource="/Resources/delete.png"
                             Width="45"
                             NavUri="/Program/Profile/Pages/ExpensePage.xaml"/>

            </WrapPanel>

        </StackPanel>

        <!--Кнопки перехода на таблицы расхода и дохода-->
        <StackPanel Orientation="Horizontal"
                    Grid.Row="2"
                    VerticalAlignment="Top"
                    Height="35"
                    Margin="330,50,304,0">

            <Grid Margin="4 0 0 0"/>

            <n:NavButton ImageSource="/Resources/chart+.png"
                             NavUri="/Program/Profile/Pages/ListProfits.xaml"
                             HorizontalAlignment="Center"
                             Margin="-3 0 0 0"
                             ButtonBase.Click="NavButton_Click"/>


            <Grid Margin="0 0 10 0"/>

            <!--Экспорт списка в Excel-->
            <n:NavButton x:Name="exportInExel_NavBtn"
                         ImageSource="/Resources/excel.png"
                         NavUri="/Program/Profile/Pages/ListProfits.xaml"
                         Margin="0 0 0 0"
                         Click="exportInExel_NavBtn_Click"
                         Width="33" 
                         Height="34"/>

            <Grid Margin="11 0 0 0"/>

            <!--Переход на таблицу расходов-->
            <n:NavButton ImageSource="/Resources/chart-.png"
                             NavUri="/Program/Profile/Pages/ListExpenses.xaml"
                             Margin="0"
                             ButtonBase.Click="NavButton_Click"/>


        </StackPanel>

        <!--Сброс последней записи-->
        <n:NavButton x:Name="restLastRecord_NavButton"
                     ImageSource="/Resources/hardReset.png"
                     Width="50"
                     Grid.Row="2"
                     HorizontalAlignment="Right"
                     VerticalAlignment="Top"
                     Margin="0 0 25 0"
                     Click="restLastRecord_NavButton_Click"/>

    </Grid>
</Page>
